﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Coldairarrow.Entity.Interface
{
    /// <summary>
    /// 库存库龄
    /// </summary>
    /// 
    public class RE_ProductInventory
    {
        /// <summary>
        /// ID
        /// </summary>
        public string ID { get; set; }
        public string RowId { get; set; }


        /// <summary>
        /// 产品编码
        /// </summary>
        public string product_barcode { get; set; }
        /// <summary>
        /// SKU
        /// </summary>
        public string product_sku { get; set; }
        /// <summary>
        /// 自定义编码
        /// </summary>
        public string reference_no { get; set; }
        /// <summary>
        /// 产品名称
        /// </summary>
        public string product_title { get; set; }
        /// <summary>
        /// 产品名称(英文)
        /// </summary>
        public string product_title_en { get; set; }
        /// <summary>
        /// 仓库代码
        /// </summary>
        public string warehouse_code { get; set; }
        /// <summary>
        /// 在途数量
        /// </summary>
        public decimal onway { get; set; }
        /// <summary>
        /// 待上架数量
        /// </summary>
        public decimal pending { get; set; }
        /// <summary>
        /// 可售数量
        /// </summary>
        public decimal sellable { get; set; }
        /// <summary>
        /// 不合格数量
        /// </summary>
        public decimal unsellable { get; set; }
        /// <summary>
        /// 待出库数量
        /// </summary>
        public decimal reserved { get; set; }
        /// <summary>
        /// 历史出库数量
        /// </summary>
        public decimal shipped { get; set; }
        /// <summary>
        /// 分享库存出库数量
        /// </summary>
        public decimal sold_shared { get; set; }
        /// <summary>
        /// 分享库存数量
        /// </summary>
        public decimal shared { get; set; }
        /// <summary>
        /// 预警库存数量
        /// </summary>
        public decimal warning { get; set; }
        /// <summary>
        /// 库存最新修改时间
        /// </summary>
        public string pi_update_time { get; set; }
        /// <summary>
        /// 仓库描述
        /// </summary>
        public string warehouse_desc { get; set; }



        /// <summary>
        /// 库存批次号信息
        /// </summary>
        public List<Batch_Info> batch_info { get; set; }


        public class Batch_Info
        {
            /// <summary>
            /// ID
            /// </summary>
            public string ID { get; set; }

            /// <summary>
            /// SKU
            /// </summary>
            public string product_sku { get; set; }
            /// <summary>
            /// 产品编码
            /// </summary>
            public string product_barcode { get; set; }
            /// <summary>
            /// 入库单号
            /// </summary>
            public string receiving_code { get; set; }
            /// <summary>
            /// 仓库编号
            /// </summary>
            public string warehouse_code { get; set; }

            /// <summary>
            /// 可售数量
            /// </summary>
            public decimal sellable_quantity { get; set; }

            /// <summary>
            /// 待出库数量
            /// </summary>
            public decimal reserved_quantity { get; set; }

            /// <summary>
            /// 库龄
            /// </summary>
            public decimal stock_age { get; set; }

            /// <summary>
            /// 库位
            /// </summary>
            public string lc_code { get; set; }

            /// <summary>
            /// 上架时间
            /// </summary>
            public string ib_fifo_time { get; set; }


            /// <summary>
            /// 状态：0-不可用，1-可用
            /// </summary>
            public string ib_status_;

            public string ib_status
            {
                get { return ib_status_; }

                set
                {

                    if (value == "0") ib_status_ = "不可用";
                    else if (value == "1") ib_status_ = "可用";
                    else ib_status_ = value;
                }
            }

            /// <summary>
            /// 库存类型,0:标准 1:不良品,2暂存
            /// </summary>
            public string ib_type_;

            public string ib_type
            {
                get { return ib_type_; }

                set
                {

                    if (value == "0") ib_type_ = "标准";
                    else if (value == "1") ib_type_ = "不良品";
                    else if (value == "2") ib_type_ = "暂存";
                    else ib_type_ = value;
                }
            }
        }

    }

}
